// 1.引入路由
import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入组件
import Home from '../views/Home';
import Login from '../views/Login';
import Game from '../views/Home/components/Game'
import Music from '../views/Home/components/Music'
import News from '../views/Home/components/News'

// 2.把路由作为插件使用
Vue.use(VueRouter)

// 3.实例化路由得到路由对象
export default new VueRouter({
    // 使用routes配置项配置路由表
    routes: [
        {
            path: '/home',
            component: Home,
            children: [
                {
                    /* 
  二级路由及多级路由的path的两种写法：
     1.完整的路径
     2.只写当前二级路由的字符串地址，不带 /
  */
                    path: 'game',
                    component: Game
                },
                {
                    path: 'music',
                    component: Music
                },
                {
                    path: 'news',
                    component: News
                }
            ]
        },
        {
            path: '/login',
            component: Login
        }
    ]
})